package 笔试记录.M8day13美团.第一场笔试;

import java.util.*;

public class Solution2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];//表示当前输出的顺序
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        Deque<Integer> list = new LinkedList<>();//用来进行结果集的处理
        for (int i = arr.length - 1; i >= 0; i--) {
            list.add(arr[i]);//给list添加对应的元素
            int count = 2;//每一个顺序表反转两次
            while (count-- > 0){
                Integer tmp = list.poll();
                list.add(tmp);
            }
        }
        Deque<Integer> deque = new LinkedList<>();
        while (!list.isEmpty()){
            deque.addFirst(list.pollFirst());
        }
        System.out.println(Arrays.asList(deque));
    }
}

/*
public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(1 <= n && n <= 100000) {
            Long[] arr = new Long[n];//表示当前输出的顺序
            for (int i = 0; i < arr.length; i++) {
                arr[i] = sc.nextLong();
            }
            Queue<Long> list = new LinkedList<>();//用来进行结果集的处理
            for (int i = arr.length - 1; i >= 0; i--) {
                list.add(arr[i]);//给list添加对应的元素
                int count = 2;//每一个顺序表反转两次
                while (count-- > 0) {
                    Long tmp = list.poll();
                    list.add(tmp);
                }
            }
            System.out.println(Arrays.asList(list));
        }else{
            throw new Exception("输入数字错误");
        }
    }
 */
